############################################
############################################
#### Replication file
#### Strategic Inclusion Without Transformation:
#### How Populist Radical Right Parties Engage 
#### with Women’s Interests
#### By Bonnie M. Meguid, Hilde Coffé, Ana Catalano Weeks & Miki Caul Kittilson 
############################################
############################################

### code uses R version 4.4.2 (base R) 

## load packages 
library(ggplot2)
library(directlabels)
library(RColorBrewer)
library(colorRamps)
getPalette = colorRampPalette(brewer.pal(9, "Spectral"))
library(lme4)
library(lmerTest)
library(interplot)
library(dplyr)
library(reshape2)
library(robustlmm)

## load data 
load("Strategic_Inclusion.RData")

temp<-dat 

##############################################################
# Codebook for Replication Data
# Tables 2 & 3 – Determinants of Women's Interests and Positions
# in Populist Radical Right Manifestos
#
# TABLE 2 – Dependent Variables: Share of manifesto devoted to women’s interests
# share_gen_equality2   – % of manifesto on gender equality rights
# share_work_family2    – % on work-family balance issues
# share_vaw2            – % on gender-based violence
# share_rep_rights2     – % on reproductive rights
# share_sexuality2      – % on sexuality & gender identity
#
# TABLE 3 – Dependent Variables: Position of manifesto on women’s interests
# share_neutral2        – % of gender sentences neutral toward women’s interests
# share_femonat2        – % of gender sentences with femonationalist framing
# gender_pos2           – Gender position score (continuous scale)
# percentcontradictory  – % of gender sentences containing mixed positions on women's interests
#
# Independent Variables (appear in both tables):
# chgvotelagged         – Change in party vote share (t-1)
# pfem_new2_lag         – Proportion of women MPs in party (t-1)
# femaleleader2         – Indicator: 1 = party led by woman, 0 otherwise
# cabinet_party2_lag    – Indicator: 1 = party in governing cabinet (t-1)
# natquota              – Indicator: 1 = national gender quota law in place
# weurope               – Indicator: 1 = Western European country
# year                  – Year of election
# log_msc               – Log of total manifesto word count
# log_sum_5int          – Log of total sentences in 5 women’s interest categories
#
# Grouping Variables (Random Effects):
# party                 – Party identifier
# countryname           – Country name
#
# Identifiers:
# country               – Country ISO or short code
# partyname             – Party name
# date                  – Date of election
# metoo                 – Indicator: manifesto issued in 2017 to 2019, when #MeToo attention heightened
#
##############################################################

##########################################
##########################################
############## Results in main ###########
##########################################
##########################################

#########################
### Figure 1 ############
#########################
vars<-c("share_gen_equality2", "share_work_family2", "share_vaw2", 
"share_rep_rights2", "share_sexuality2", "pfem_new2_lag", "femaleleader2_lag",
 "chgvotelagged",  "cabinet_party2_lag", "natquota", "year", "manifesto_sen_count","weurope",
	"party", "country", "countryname", "partyname", "date", "log_msc")
visdat<-na.omit(temp[,vars])
nrow(visdat)

vars<-c("year","pfem_new2_lag", "share_gen_equality2", "share_vaw2", "share_work_family2", "share_rep_rights2", "share_sexuality2")
test_dat22<-visdat[,vars]

test_data_long22 <- melt(test_dat22, id=c("year","pfem_new2_lag"))  # convert to long format
nrow(test_data_long22)
head(test_data_long22)

test_data_long22$variable2<-NA
test_data_long22$variable2[test_data_long22$variable=="share_vaw2"]<-"Gender-based Violence"
test_data_long22$variable2[test_data_long22$variable=="share_work_family2"]<-"Work-Family Balance"
test_data_long22$variable2[test_data_long22$variable=="share_gen_equality2"]<-"Gender Rights"
test_data_long22$variable2[test_data_long22$variable=="share_rep_rights2"]<-"Reproductive"
test_data_long22$variable2[test_data_long22$variable=="share_sexuality2"]<-"Sexuality"

test_data_long22$variable2<-as.factor(test_data_long22$variable2)

set.seed(02138)

bypar <- ggplot(data = test_data_long22, aes(x = year, y = value, color = variable2, shape = variable2)) +
  geom_point(size = 2) + 
  geom_smooth(aes(fill = variable2), method = "loess", se = TRUE, size = 0.8, alpha = 0.3) +  # match fill to variable2
  labs(
    x = "",
    y = "PRR Party Attention to Women's Interests (% Manifesto)",
    title = ""
  ) +
  theme_classic(base_size = 12) +
  theme(
    panel.border = element_blank(),
    panel.grid.major = element_blank(),
    panel.grid.minor = element_blank(),
    axis.line = element_line(colour = "black"),
    legend.title = element_blank(),
    plot.title = element_text(size = 12, face = "bold"),
    legend.text = element_text(size = 10)
  ) +
  scale_color_brewer(palette = "Set1") +   # colored lines
  scale_fill_brewer(palette = "Set1") +    # matching CI fill
  xlim(1984, 2022) +
  coord_cartesian(ylim = c(0, 5))

bypar


#########################
#########################
## Figure 2 #############
#########################
#########################

vars<-c("share_gender_egal2", "share_gender_trad2", "gender_pos2",  "share_neutral2", "share_femonat2", 
"pfem_new2_lag", "femaleleader2_lag",
 "chgvotelagged",  "cabinet_party2_lag", "natquota", "year", "sum_sen_5interests",
	"party", "country", "countryname", "partyname", "date", "log_msc")
visdat<-na.omit(temp[,vars])


vars<-c("year", "share_gender_egal2", "share_gender_trad2", "share_neutral2", "share_femonat2")
test_dat23<-visdat[,vars]

test_data_long23 <- melt(test_dat23, id=c("year"))  # convert to long format
nrow(test_data_long23)

test_data_long23$variable2<-NA
test_data_long23$variable2[test_data_long23$variable=="share_gender_egal2"]<-"Gender Egalitarian"
test_data_long23$variable2[test_data_long23$variable=="share_gender_trad2"]<-"Gender Traditional"
test_data_long23$variable2[test_data_long23$variable=="share_neutral2"]<-"Neutral"
test_data_long23$variable2[test_data_long23$variable=="share_femonat2"]<-"Femonationalist"
test_data_long23$variable2<-as.factor(test_data_long23$variable2)


mean(visdat$share_femonat2[visdat$year<1998], na.rm=TRUE)
mean(visdat$share_femonat2[visdat$year>2017], na.rm=TRUE)

set.seed(02138)

bypar <- ggplot(data = test_data_long23, aes(x = year, y = value, color = variable2, shape = variable2)) +
  geom_point(size = 2) + 
  geom_smooth(aes(fill = variable2), method = "loess", se = TRUE, size = 0.8, alpha = 0.3) +  # match fill to variable2
  labs(
    x = "",
    y = "PRR Party Positions on Women's Interests",
    title = ""
  ) +
  theme_classic(base_size = 12) +
  theme(
    panel.border = element_blank(),
    panel.grid.major = element_blank(),
    panel.grid.minor = element_blank(),
    axis.line = element_line(colour = "black"),
    legend.title = element_blank(),
    plot.title = element_text(size = 12, face = "bold"),
    legend.text = element_text(size = 10)
  ) +
  scale_color_brewer(palette = "Set1") +   # colored lines
  scale_fill_brewer(palette = "Set1") +    # matching CI fill
  xlim(1984, 2022) +
  coord_cartesian(ylim = c(0, 100))

bypar

##################################
### Table 2 
##################################

options(scipen = 999)

vars<-c("share_gen_equality2", "share_work_family2", "share_vaw2", "share_rep_rights2",
 "share_sexuality2", "pfem_new2_lag", "femaleleader2",
 "chgvotelagged",  "cabinet_party2_lag", "natquota", "year", "manifesto_sen_count","weurope",
	"party", "country", "countryname", "partyname", "date", "metoo", "log_msc")
visdat<-na.omit(temp[,vars])
nrow(visdat)

model1<-lmer(share_gen_equality2  ~  chgvotelagged + pfem_new2_lag + femaleleader2 + 
 cabinet_party2_lag  + natquota + weurope + year + log_msc +
	(1 | party ) + 	(1 | countryname), data=visdat,  REML=F)
summary(model1)

model2<-lmer(share_work_family2  ~  chgvotelagged + pfem_new2_lag + femaleleader2 + 
 cabinet_party2_lag  + natquota + weurope + year + log_msc +
	(1 | party ) + 	(1 | countryname), data=visdat,  REML=F)
summary(model2)

model3<-lmer(share_vaw2 ~  chgvotelagged + pfem_new2_lag + femaleleader2 + 
 cabinet_party2_lag  + natquota + weurope + year + log_msc +
	(1 | party ) + 	(1 | countryname), data=visdat,  REML=F)
summary(model3)

model4<-lmer(share_rep_rights2 ~  chgvotelagged + pfem_new2_lag + femaleleader2 + 
 cabinet_party2_lag  + natquota + weurope + year + log_msc +
	(1 | party ) + 	(1 | countryname), data=visdat,  REML=F)
summary(model4)

model5<-lmer(share_sexuality2 ~  chgvotelagged + pfem_new2_lag + femaleleader2 + 
 cabinet_party2_lag  + natquota + weurope + year + log_msc +
	(1 | party ) + 	(1 | countryname), data=visdat,  REML=F)
summary(model5)

###################################
########### Figure 3 ##############
###################################

library(lme4)
library(ggeffects)
library(ggplot2)

# Generate predictions
preds <- ggpredict(model1, terms = "chgvotelagged [-20:20]")

# Convert to data frame
preds_df <- as.data.frame(preds)

# Plot manually
ggplot(preds_df, aes(x = x, y = predicted)) +
  geom_line(color = "blue", size = 1.2) +
  geom_ribbon(aes(ymin = conf.low, ymax = conf.high), alpha = 0.2, fill = "blue") +
  geom_hline(yintercept = 0, linetype = "dashed", color = "black") +  # line at y = 0
  geom_rug(data = visdat, aes(x = chgvotelagged), sides = "b", alpha = 0.4, inherit.aes = FALSE) +  # rug plot
  coord_cartesian(xlim = c(-20, 20)) +
  labs(
    x = "Change in Vote Share (Lagged)",
    y = "Predicted Attention to Gender Equality",
    title = "Predicted Values by Lagged Vote Change"
  ) +
  theme_minimal()


# Step 1: Calculate mean and SD of chgvotelagged
mean_chg <- mean(visdat$chgvotelagged, na.rm = TRUE)
sd_chg <- sd(visdat$chgvotelagged, na.rm = TRUE)
low_chg <- mean_chg - sd_chg
high_chg <- mean_chg + sd_chg

# Step 2: Get predicted values at ±1 SD using ggpredict
preds_sd <- ggpredict(
  model1,
  terms = sprintf("chgvotelagged [%.2f, %.2f]", low_chg, high_chg)
)

preds_sd 

# Predicted values of share_gen_equality2

#chgvotelagged | Predicted |     95% CI
#--------------------------------------
#        -3.89 |      1.09 | 0.68, 1.51
#         6.97 |      0.59 | 0.19, 0.99


#####################################################
############# Table 3 ###############################
#####################################################

vars<-c("share_neutral2", "share_femonat2", "gender_pos2",
 "share_sexuality2", "pfem_new2_lag", "femaleleader2",
 "chgvotelagged",  "cabinet_party2_lag", "natquota", "year", "sum_sen_5interests", "weurope",
	"party", "country", "countryname", "partyname", "date", "metoo", "log_sum_5int")
visdat2<-na.omit(temp[,vars])
nrow(visdat2)

model6<-lmer(share_neutral2  ~  chgvotelagged + pfem_new2_lag + femaleleader2 + 
 cabinet_party2_lag  + natquota + weurope + year + log_sum_5int +
	(1 | party ) + 	(1 | countryname), data=visdat2,  REML=F)
summary(model6)

vars<-c("share_neutral2", "share_femonat2", "gender_pos2", "percentcontradictory",
 "share_sexuality2", "pfem_new2_lag", "femaleleader2",
 "chgvotelagged",  "cabinet_party2_lag", "natquota", "year", "sum_sen_5interests", "weurope",
	"party", "country", "countryname", "partyname", "date", "log_sum_5int")
visdat3<-na.omit(temp[,vars])
nrow(visdat3)

model7<-lmer(percentcontradictory  ~  chgvotelagged + pfem_new2_lag + femaleleader2 + 
 cabinet_party2_lag  + natquota + weurope + year + log_sum_5int +
	(1 | party ) + 	(1 | countryname), data=visdat3,  REML=F)
summary(model7)

model8<-lmer(share_femonat2 ~  chgvotelagged + pfem_new2_lag + femaleleader2 + 
 cabinet_party2_lag  + natquota + weurope + year + log_sum_5int +
	(1 | party ) + 	(1 | countryname), data=visdat2,  REML=F)
summary(model8)

model9<-lmer(gender_pos2 ~  chgvotelagged + pfem_new2_lag + femaleleader2 + 
 cabinet_party2_lag  + natquota + weurope + year + log_sum_5int +
	(1 | party ) + 	(1 | countryname), data=visdat2,  REML=F)
summary(model9) # 

##########################################
##########################################
############## Appendix ##################
##########################################
##########################################

##################################
## Summary statistics -- Table A2 + descriptives 
##################################

vars<-c("share_gen_equality2", "share_work_family2", "share_vaw2", "pfem_new2_lag", "share_rep_rights2", "share_sexuality2",
"femaleleader2", "chgvotelagged",  "cabinet_party2_lag", "natquota", "year", "manifesto_sen_count","weurope",
	"party", "country", "countryname", "partyname", "date", 
  "metoo", "log_msc")
visdata<-na.omit(temp[,vars])
nrow(visdata)

library(stargazer)
stargazer(visdata)

mean(visdata$manifesto_sen_count) ##
median(visdata$manifesto_sen_count) ## 

mean(visdata$share_gen_equality2) ##
mean(visdata$share_work_family2) ##
mean(visdata$share_vaw2) ###0.2
summary(visdata$share_rep_rights2) ###0.2
summary(visdata$share_sexuality2) ###0.2

# Function to calculate percent of 0s
percent_zeros <- function(x) {
  round(mean(x == 0, na.rm = TRUE) * 100, 1)  # Multiplies proportion by 100 to get percent
}

# Calculate for each variable
percent_zeros(visdata$share_gen_equality2)
percent_zeros(visdata$share_work_family2)
percent_zeros(visdata$share_vaw2)
percent_zeros(visdata$share_rep_rights2)
percent_zeros(visdata$share_sexuality2)


### for positions 

vars<-c("gender_pos2",  "share_neutral2", "share_femonat2", "pfem_new2_lag", "femaleleader2_lag",
 "chgvotelagged",  "cabinet_party2_lag", "natquota", "year", "sum_sen_5interests",
	"party", "country", "countryname", "partyname", "date", "log_sum_5int")
visdataa<-na.omit(temp[,vars])
nrow(visdataa)
stargazer(visdataa)

### and finally for percent contradictory (drops two observations that have neither traditional nor egalitarian positions)

vars<-c("percentcontradictory", "pfem_new2_lag", "femaleleader2_lag",
 "chgvotelagged",  "cabinet_party2_lag", "natquota", "year", 
	"party", "country", "countryname", "partyname", "date")
visdatz<-na.omit(temp[,vars])
nrow(visdatz)
stargazer(visdatz)

## A3 Table of parties by country and election (used to construct table manually)


vars<-c("share_gen_equality2", "share_work_family2", "share_vaw2", "pfem_new2_lag", "femaleleader2",
 "chgvotelagged",  "cabinet_party2_lag", "natquota", "year", "manifesto_sen_count","weurope",
	"party", "country", "countryname", "partyname", "date", 
 "share_rep_rights2", "share_sexuality2", "metoo", "log_msc")
visdatzz<-na.omit(temp[,vars])
nrow(visdatzz)

vars<-c("countryname", "party", "partyname", "date")
visdat2a<-visdatzz[,vars]
visdat3a<-visdat2a[order(visdat2a$countryname, visdat2a$date),]
## fix(visdat3a)
nrow(visdat3a) 

n_countries <- length(unique(visdat3a$countryname))
n_parties   <- length(unique(visdat3a$party))

n_countries
n_parties

##################################
##################################
## Tables B1 and B2
##################################
##################################

model1a<-lmer(share_gen_equality2  ~  chgvotelagged  +
	(1 | party ) + 	(1 | countryname), data=visdat,  REML=F)
summary(model1a)

model2a<-lmer(share_work_family2  ~   pfem_new2_lag +
	(1 | party ) + 	(1 | countryname), data=visdat,  REML=F)
summary(model2a) 

model3a<-lmer(share_vaw2 ~   femaleleader2 + 
 	(1 | party ) + 	(1 | countryname), data=visdat,  REML=F)
summary(model3a) 

model3aa<-lmer(share_vaw2 ~   pfem_new2_lag + 
 	(1 | party ) + 	(1 | countryname), data=visdat,  REML=F)
summary(model3aa) 

model6a<-lmer(share_neutral2  ~  chgvotelagged + 
	(1 | party ) + 	(1 | countryname), data=visdat2,  REML=F)
summary(model6a)

model8a<-lmer(share_femonat2 ~  chgvotelagged +
	(1 | party ) + 	(1 | countryname), data=visdat2,  REML=F)
summary(model8a) 

model8aa<-lmer(share_femonat2 ~  pfem_new2_lag +
	(1 | party ) + 	(1 | countryname), data=visdat2,  REML=F)
summary(model8aa) 

model9a<-lmer(gender_pos2 ~  femaleleader2 +
	(1 | party ) + 	(1 | countryname), data=visdat2,  REML=F)
summary(model9a) 


##################################
###  FE models 
##################################

##########################
###### Table B3
##########################

modb2_1<-lm(share_gen_equality2  ~  chgvotelagged + pfem_new2_lag + femaleleader2 + 
 cabinet_party2_lag  + natquota + year +
log_msc + as.factor(party), data=visdat)
summary(modb2_1) 

modb2_2<-lm(share_work_family2  ~  chgvotelagged + pfem_new2_lag + femaleleader2 + 
  cabinet_party2_lag  + natquota + year + 
log_msc + as.factor(party), data=temp)
summary(modb2_2) 

modb2_3<-lm(share_vaw2 ~  chgvotelagged + pfem_new2_lag + femaleleader2 + 
  cabinet_party2_lag  + natquota + year + 
log_msc + as.factor(party), data=temp)
summary(modb2_3) 

modb2_4<-lm(share_rep_rights2  ~  chgvotelagged + pfem_new2_lag + femaleleader2 + 
  cabinet_party2_lag  + natquota + year + 
log_msc + as.factor(party), data=temp)
summary(modb2_4) 

modb2_5<-lm(share_sexuality2 ~  chgvotelagged + pfem_new2_lag + femaleleader2 + 
  cabinet_party2_lag  + natquota + year + 
log_msc + as.factor(party), data=temp)
summary(modb2_5) 

##########################
###### Table B4
##########################

out_fe2a<-lm(share_neutral2 ~ chgvotelagged +  pfem_new2_lag + femaleleader2 + 
 cabinet_party2_lag  + natquota + year + log_sum_5int + as.factor(party), data=temp)
summary(out_fe2a) 

out_fe2b<-lm(percentcontradictory ~ chgvotelagged +  pfem_new2_lag + femaleleader2 + 
 cabinet_party2_lag  + natquota + year + log_sum_5int + as.factor(party), data=temp)
summary(out_fe2b) 

out_fe2c<-lm(share_femonat2  ~ chgvotelagged +  pfem_new2_lag + femaleleader2 + 
 cabinet_party2_lag  + natquota + year + log_sum_5int + as.factor(party), data=temp)
summary(out_fe2c) 

out_fe2d<-lm(gender_pos2 ~ chgvotelagged +  pfem_new2_lag + femaleleader2 + 
 cabinet_party2_lag  + natquota + year + log_sum_5int + as.factor(party), data=temp)
summary(out_fe2d) 

##################################
### Table B5
###################################

model1<-lmer(share_gen_equality2  ~  chgvotelagged + pfem_new2_lag + femaleleader2 + 
 cabinet_party2_lag  + natquota + weurope + year + log_msc + metoo +
	(1 | party ) + 	(1 | countryname), data=visdat,  REML=F)
summary(model1)

model2<-lmer(share_work_family2  ~  chgvotelagged + pfem_new2_lag + femaleleader2 + 
 cabinet_party2_lag  + natquota + weurope + year + log_msc + metoo +
	(1 | party ) + 	(1 | countryname), data=visdat,  REML=F)
summary(model2)

model3<-lmer(share_vaw2 ~  chgvotelagged + pfem_new2_lag + femaleleader2 + 
 cabinet_party2_lag  + natquota + weurope + year + log_msc + metoo +
	(1 | party ) + 	(1 | countryname), data=visdat,  REML=F)
summary(model3)  

model4<-lmer(share_rep_rights2 ~  chgvotelagged + pfem_new2_lag + femaleleader2 + 
 cabinet_party2_lag  + natquota + weurope + year + log_msc + metoo +
	(1 | party ) + 	(1 | countryname), data=visdat,  REML=F)
summary(model4)

model5<-lmer(share_sexuality2 ~  chgvotelagged + pfem_new2_lag + femaleleader2 + 
 cabinet_party2_lag  + natquota + weurope + year + log_msc + metoo +
	(1 | party ) + 	(1 | countryname), data=visdat,  REML=F)
summary(model5)

##################################
### Table B6
###################################

model6<-lmer(share_neutral2  ~  chgvotelagged + pfem_new2_lag + femaleleader2 + 
 cabinet_party2_lag  + natquota + weurope + year +  log_sum_5int + metoo +
	(1 | party ) + 	(1 | countryname), data=visdat2,  REML=F)
summary(model6)

vars<-c("share_neutral2", "share_femonat2", "gender_pos2", "percentcontradictory",
 "share_sexuality2", "pfem_new2_lag", "femaleleader2",
 "chgvotelagged",  "cabinet_party2_lag", "natquota", "year", "sum_sen_5interests", "weurope",
	"party", "country", "countryname", "partyname", "date", "log_sum_5int", "metoo")
visdat3<-na.omit(temp[,vars])
nrow(visdat3)

model7<-lmer(percentcontradictory  ~  chgvotelagged + pfem_new2_lag + femaleleader2 + 
 cabinet_party2_lag  + natquota + weurope + year +  log_sum_5int + metoo +
	(1 | party ) + 	(1 | countryname), data=visdat3,  REML=F)
summary(model7)

model8<-lmer(share_femonat2 ~  chgvotelagged + pfem_new2_lag + femaleleader2 + 
 cabinet_party2_lag  + natquota + weurope + year +  log_sum_5int + metoo +
	(1 | party ) + 	(1 | countryname), data=visdat2,  REML=F)
summary(model8)

model9<-lmer(gender_pos2 ~  chgvotelagged + pfem_new2_lag + femaleleader2 + 
 cabinet_party2_lag  + natquota + weurope + year +  log_sum_5int + metoo +
	(1 | party ) + 	(1 | countryname), data=visdat2,  REML=F)
summary(model9) 


##################################
#### Table B7 ################
##################################

model1_ldv<-lmer(share_gen_equality2  ~  chgvotelagged + pfem_new2_lag + femaleleader2 + 
 cabinet_party2_lag  + natquota + weurope + log_msc +  lag1_share_gen_equality2 + 
	(1 | party ) + 	(1 | countryname), data=temp,  REML=F)
summary(model1_ldv)

model3_ldv<-lmer(share_vaw2  ~  chgvotelagged + pfem_new2_lag + femaleleader2 + 
 cabinet_party2_lag  + natquota + weurope + log_msc + lag1_share_vaw2 +
	(1 | party ) + 	(1 | countryname), data=temp,  REML=F)
summary(model3_ldv)

model6_ldv<-lmer(share_neutral2  ~  chgvotelagged + pfem_new2_lag + femaleleader2 + 
 cabinet_party2_lag  + natquota + weurope + log_sum_5int  + lag1_share_neutral2 + 
	(1 | party ) + 	(1 | countryname), data=temp,  REML=F)
summary(model6_ldv)

model8_ldv<-lmer(share_femonat2 ~  chgvotelagged + pfem_new2_lag + femaleleader2 + 
 cabinet_party2_lag  + natquota + weurope + log_sum_5int + lag1_share_femonat2 + 
	(1 | party ) + 	(1 | countryname), data=temp,  REML=F)
summary(model8_ldv) 

#################################
#### Table B8 ##########
#################################

##################### B8 column 1 rights 

model1<-lmer(share_gen_equality2  ~  chgvotelagged + pfem_new2_lag + femaleleader2 + 
 cabinet_party2_lag  + natquota + weurope + year + log_msc +
	(1 | party ) + 	(1 | countryname), data=visdat,  REML=F)
summary(model1) 

library(performance) 
outliers <- check_outliers(model1, method = "cook")
outliers

no_outliers <- visdat[-c(33), ]
nrow(no_outliers)

geneq_noout<-lmer(share_gen_equality2  ~  chgvotelagged + pfem_new2_lag + femaleleader2 + 
 cabinet_party2_lag  + natquota + weurope + year + log_msc +
	(1 | party ) + 	(1 | countryname), data=no_outliers,  REML=F)
summary(geneq_noout)

##################### B8 column 2 violence 

model1zz<-lmer(share_vaw2  ~  chgvotelagged + pfem_new2_lag + femaleleader2 + 
 cabinet_party2_lag  + natquota + weurope + year + log_msc +
	(1 | party ) + 	(1 | countryname), data=visdat,  REML=F)
summary(model1zz)  # holds 

outliers <- check_outliers(model1zz, method = "cook")
outliers

no_outliers <- visdat[-c(84, 96, 97), ]
nrow(no_outliers)

vaw_noout<-lmer(share_vaw2  ~  chgvotelagged + pfem_new2_lag + femaleleader2 + 
 cabinet_party2_lag  + natquota + weurope + year + log_msc +
	(1 | party ) + 	(1 | countryname), data=no_outliers,  REML=F)
summary(vaw_noout)  

##################### B8 column 3 femonationalism 

model8<-lmer(share_femonat2 ~  chgvotelagged + pfem_new2_lag + femaleleader2 + 
 cabinet_party2_lag  + natquota + weurope + year + log_sum_5int +
	(1 | party ) + 	(1 | countryname), data=visdat2,  REML=F)
summary(model8)

outliers <- check_outliers(model8, method = "cook")
outliers

no_outliers <- visdat2[-c(29, 67, 73, 79), ]

nrow(no_outliers)

femonat_noout<-lmer(share_femonat2 ~  chgvotelagged + pfem_new2_lag + femaleleader2 + 
 cabinet_party2_lag  + natquota + weurope + year + log_sum_5int +
	(1 | party ) + 	(1 | countryname), data=no_outliers,  REML=F)
summary(femonat_noout)
 

